A2345,
Good question, but it applies to many others, not just Americans. Today is a big national holiday in Hungary and about one out of 3 houses have huge Hungarian flags draped for all to see. These serve a number of purposes...
For one it fosters national unity. While you look at your neighbor thinking what an idiot he is, the flag reminds you that you have something important in common with him that neither of you must ever forget. It reminds you what your priorities are and where you stand on issues that are really important.
If you put out a flag, you are saying to your countrymen who may have fought a war for you that you support them. That is very important because those vets risked life and limb for you, your family, your neighbors and their families and that needs to be acknowledged. They surely appreciate seeing that people appreciated their efforts. The same applies for present and future soldiers, officers, diplomats and even civil servants to an extent.
Another thing a flag does is it quickly identifies internal enemies. Some get offended by such national pride and it's important to know who these people are. They are the ones who may not be fighting for the same causes. It's important to know who's on your side and who's not.
That's 3 reasons I can think of offhand and there are probably more. Good question, though, provokes thought.